package com.lovo.pz.role;

import com.lovo.pz.util.GameUtil;

import java.awt.*;

/**
 * 带铁桶僵尸角色
 * @author 白德柯
 *
 */
public class BucketheadZombieRole extends ZombieRole{
    public BucketheadZombieRole(Component component) {
        super(component);
    }
    public void initRole(){
        super.initRole();
        setHp(30);
        setScore(200);
        setZombieType(BUCKETHEAD_ZOMBIE_WALK);
    }
    public void paintRole(Graphics g){
        super.paintRole(g);
        if(getZombieType() == BUCKETHEAD_ZOMBIE_WALK){
            g.drawImage(GameUtil.bucketheadZombieWalkImage,getRoleX() - 80, getRoleY() - 70,getComponent());
        }
        if(getZombieType() == BUCKETHEAD_ZOMBIE_ATTACK){
            g.drawImage(GameUtil.bucketheadZombieAttackImage,getRoleX() - 80, getRoleY() - 70,getComponent());
        }
    }
    public void action(){
        if(getHp() < 20){
            if(getZombieType() == BUCKETHEAD_ZOMBIE_WALK){
                setZombieType(ZOMBIE_WALK);
            }else if(getZombieType() == BUCKETHEAD_ZOMBIE_ATTACK){
                setZombieType(ZOMBIE_ATTACK);
            }
        }
        super.action();
    }
}
